package main

import (
	"fmt"
	"strings"
)
type Person struct {
	Name string
	Id int32
}

type PersonMgr struct {
	VS       []*Person
}

//字符串列表里是否有指定的字符串
func CheckContainStr(glossary []string, sub string) bool {
	for i := 0; i < len(glossary); i++ {
		if glossary[i] == sub {
			return true
		}
	}
	return false
}

/*Q10. (1) 斐波那契
1. 斐波那契数列以： 1; 1; 2; 3; 5; 8; 13; : : : 开始。或者用数学形式表达： x1 = 1; x2 =
1; xn = xn−1 + xn−2 8n > 2。
编写一个接受 int 值的函数，并给出这个值得到的斐波那契数列。*/
func fbnc(num int) (nums []int) {
	for i := 0; i < num; i++{
		n := 1
		if i == 0 || i == 1 {
			_ = append(nums, n)
		}else{
			_ = append(nums, (i - 1) + (i - 2))
		}
	}
	return nums
}

func main() {
	strList := []string{"1234", "324134","asdf"}
	str := "12343"
	has := CheckContainStr(strList, str)
	fmt.Println(has)
	//strings包操作
	fmt.Println(strings.Contains(str, "34"))

	//append
	personMgr := new(PersonMgr)
	personMgr.VS = append(personMgr.VS, &Person{"wor", 111})
	fmt.Println(personMgr.VS[0])

	nums := fbnc(10)
	fmt.Println(nums)

}
